package com.study.contoller;

import com.study.R;
import com.study.entity.ApplyType;
import com.study.service.ApplyTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author lxl
 * @version 2022-06-21 19:40
 */

@RestController
@RequestMapping("/api/apply-type")
public class ApplyTypeController {
    
    @Autowired
    private ApplyTypeService applyTypeService;
    
    
    @PostMapping("insert")
    public R insert(@RequestBody ApplyType applyType) {
        return R.ok().setData(applyTypeService.insert(applyType));
    }
    
    @DeleteMapping("delete-by-primary/{applyTypeId}")
    public R deleteByPrimary(@PathVariable Long applyTypeId) {
        return R.ok().setData(applyTypeService.deleteByPrimaryKey(applyTypeId));
    }
    
    @PutMapping("update-by-pirmary")
    public R updateByPrimary(@RequestBody ApplyType applyType) {
        return R.ok().setData(applyTypeService.updateByPrimaryKey(applyType));
    }
    
    @GetMapping("selects")
    public R selects(ApplyType applyType) {
        return R.ok().setData(applyTypeService.selects(applyType));
    }
}
